<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="HNUST/../../user/css/pintuer.css">
<link rel="stylesheet" href="HNUST/../../user/css/admin.css">
<script src="HNUST/../../user/js/jquery.js"></script>
<script src="HNUST/../../user/js/pintuer.js"></script>
<script type="text/javascript">
function del(id){
	if(confirm("确定要删除！")){
		$.ajax({
			type:"GET",
			url:"/HNUST/scenic/delscenic",
			data:{id:id},
			dataType:"json",
			success:function(data){
				alert(data.result);
				location.reload();	
			},
			error:function(data){
				alert("删除失败！");
			}
		});
	}
}
</script>
</head>
<body>
<%if(session.getAttribute("userid")!=null) {%>
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
    <form action="scenicmh?pageNow=1" method="post">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="scenicadd"> 添加内容</a> </li>
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="scenic_name" class="input" style="width:250px; line-height:17px;display:inline-block" />
         <button class="button bg-main icon-check-square-o" type="submit">搜素</button></li>
      </ul>
      </form>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">编号</th>
        <th>图片</th>
        <th>名称</th>
        <th>地区</th>
        <th width="10%">更新时间</th>
        <th width="310">操作</th>
      </tr>
      
      <c:forEach items="${scenic }" var="item" varStatus="status">
        <tr>
          <td style="text-align:left; padding-left:25px;">
           ${status.index+1 }</td>
          
          <td width="10%"><img src="${item.scenic_tp }" alt="" width="120" height="70" /></td>
          <td>${item.scenic_name }</td>
         
          <td>${item.scenic_dq }</td>
          <td>${item.scenic_time }</td>
          <td><div class="button-group"> 
          <a class="button border-main" href="Updatejq?id=${item.scenic_id }"><span class="icon-edit"></span> 修改</a> 
          <button class="button bg-main icon-trash-o" onclick="del(${item.scenic_id});">删除</button>
        </tr>
   		
   </c:forEach>
     		 <tr>
            <td colspan="8"><div class="pagelist"> 
            <!-- 分页功能 start -->
            <div align="center">
                <font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
                ${page.pageNow} 页</font> <a href="queryAll?pageNow=1">首页</a>
                <c:choose>
                    <c:when test="${page.pageNow - 1 > 0}">
                        <a href="queryAll?pageNow=${page.pageNow - 1}">上一页</a>
                    </c:when>
                    <c:when test="${page.pageNow - 1 <= 0}">
                        <a href="queryAll?pageNow=1">上一页</a>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${page.totalPageCount==0}">
                        <a href="queryAll?pageNow=${page.pageNow}">下一页</a>
                    </c:when>
                    <c:when test="${page.pageNow + 1 < page.totalPageCount}">
                        <a href="queryAll?pageNow=${page.pageNow + 1}">下一页</a>
                    </c:when>
                    <c:when test="${page.pageNow + 1 >= page.totalPageCount}">
                        <a href="queryAll?pageNow=${page.totalPageCount}">下一页</a>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${page.totalPageCount==0}">
                        <a href="queryAll?pageNow=${page.pageNow}">尾页</a>
                    </c:when>
                    <c:otherwise>
                        <a href="queryAll?pageNow=${page.totalPageCount}">尾页</a>
                    </c:otherwise>
                </c:choose>
            </div>
            <!-- 分页功能 End -->
            </div></td>
        </tr>
        
    </table>
  </div>
  <%}else{%>
	  <center>
	  对不起，你没有登录，请先<a href="http://127.0.0.1:8086/HNUST/user/login" target="blank">登录</a>
	  </center>
 
<%} %>
<script>  
function a() {
	window.location="http://127.0.0.1:8081/HNUST/user/login";  	
}
</script> 
</body>
</html>